package com.neighbor.neighborhooduser.controller;

import com.neighbor.neighborhooduser.service.IPostCollectionsService;
import com.neighbor.neighborhooduser.utils.ResponseMsg;
import jakarta.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 帖子收藏记录表 前端控制器
 * </p>
 *
 * @author song
 * @since 2025-09-22 09:13:04
 */
@RestController

public class PostCollectionsController {

    @Autowired
    private IPostCollectionsService postCollectionsService;

    @PostMapping("/posts/{postId}/collect")
    public ResponseMsg setCollect(@PathVariable Integer postId, HttpServletRequest request){


        Boolean isCollected = postCollectionsService.setCollect(postId, request);

        return ResponseMsg.getInstance(ResponseMsg.SUCCESS,"响应成功",isCollected);
    }

}
